CD-Rom media contain subcode R-W channel data which corresponds to and is stored along with the main channel data. Ninety-six bytes of corresponding subcode R-W channel data stored in a unit referred to as a packet typically accompany each sector of the main channel data. Each packet is divided into four packs each containing twenty-four bytes of data. The subcode R-W channel data is six bits wide. The subcode R-W channel data is encoded by an 8-way interleaving process as well as scrambling within each pack.
An error correction code is used to ensure the data in the subcode R-W channel. To improve the burst error correction capability, the 8-way interleaving process is added to the error-correction system. For example, the fourth, twelfth and twentieth bytes D3, D11 and D19, respectively, are stored in the fourth pack Pack 3. In the interleaving process each pack's 24 bytes of data are spread over eight packs by an 8-way interleave as illustrated in FIG. 1. In the interleave process as illustrated in FIG. 1, the 24 bytes of the first pack are designated as Di, where i is equal to 0 through 23. The byte Di will be located in pack y, as calculated using the following equation (1), at location i, where x is equal to the original pack number ranging from 0 to infinity and i is equal to the byte location of the original pack data. EQU y=x +(i mod 8) (1)
FIG. 2 illustrates the interleaving of the first pack Di with the original 24 bytes of the second pack Ei. The third Fi and fourth packs Gi are interleaved in the same manner as the first two packs.
Before the packs are interleaved, each pack is scrambled by swapping three pairs of bytes within each of the four packs. During scrambling, if the bytes within a pack are denoted by Xi (i=0 to 23), the byte X1 is swapped with the byte X18, the byte X2 is swapped with the byte X5 and the byte X3 is swapped with the byte X23, within each pack.
A full packet of subchannel R-W data, made up of four packs, Di, Ei, Fi and Gi, each having twenty-four bytes, is illustrated in FIG. 3 showing the 8-way interleave and scrambling of each pack. As is evident from FIG. 3, after interleaving and scrambling, the data for one packet of subchannel R-W data is spread over eleven packs. The bytes of data within the third pack of this packet are denoted by Fi, where i is equal to the number of the byte within the pack. The bytes of data within the fourth pack of this packet are denoted by Gi, where i is equal to the number of the byte within the pack.
When recorded on the CD-Rom, the sub-code R-W channel data is scrambled and then interleaved as explained above. Therefore, when the sub-code R-W channel data is read from the CD-Rom the packs must be de-interleaved and de-scrambled in order to be transferred to the host in a correct and meaningful order. A prior art de-interleaving and de-scrambling method transfers the encoded subchannel R-W data bytes to an external buffer memory in the order that they are read. A system local processor coupled to the buffer memory will then perform the de-interleaving and de-scrambling of the packs. This approach however, requires big overhead for the local processor's computing power as well as consuming valuable buffer memory bandwidth.
A second prior art method uses an on-the-fly hardware de-interleaving and de-scrambling mechanism. As described above, each packet consists of 4 packs. After interleaving, each pack's data is spread over eight consecutive packs and therefore each packet is spread over three consecutive packets or the equivalent of 288 bytes of data. Therefore, this mechanism must be able to read and store at least three packets of subcode R-W channel data before reconstructing the packet through de-scrambling and de-interleaving. Accordingly, the hardware must have storage elements capable of storing 288 bytes of data, as well as complex control circuitry to handle the de-scramble and de-interleave tasks once the data is stored.
What is needed is a method and apparatus which dynamically calculates the final location of each byte within a pack of interleaved and scrambled data as it is received. What is further needed is a method and apparatus which de-interleaves and de-scrambles encoded subchannel R-W data without the use of storage elements.